package www.sofn.com.sys.user.domain.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import www.sofn.com.sys.user.dictionary.SexEnum;
import www.sofn.com.validate.group.InsertGroup;
import www.sofn.com.validate.group.UpdateGroup;

@Data
@Accessors(chain = true)
@Schema(description = "用户信息")
public class SysUserVO {

    @Schema(description = "id")
    @NotBlank(message = "id不能为空", groups = UpdateGroup.class)
    private String id;

    @Schema(description = "用户名")
    @Length(min = 2, max = 20, message = "用户名不能小于{min}且不能大于{max}个字符", groups = {UpdateGroup.class, InsertGroup.class})
    @NotBlank(message = "用户名不能为空", groups = {UpdateGroup.class, InsertGroup.class})
    private String name;

    @Schema(description = "账号")
    @Length(min = 4, max = 20, message = "账号不能小于{min}且不能大于{max}个字符", groups = {UpdateGroup.class, InsertGroup.class})
    @NotBlank(message = "账号不能为空", groups = {UpdateGroup.class, InsertGroup.class})
    private String username;

    @Schema(description = "密码")
    @NotBlank(message = "密码不能为空", groups = {InsertGroup.class})
    @Length( max = 32, message = "密码不能大于{max}个字符", groups = { InsertGroup.class})
    private String password;

    @Schema(description = "部门ID")
    private Long departmentId;

    @Schema(description = "电话")
    @Length(max = 15, message = "电话不能大于{max}个字符", groups = {UpdateGroup.class, InsertGroup.class})
    private String phone;

    @Schema(description = "性别")
    private SexEnum sex;
}
